home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 7 / BBS in a Box - Macintosh - Volume VII (BBS in a Box) (January 1993).iso / Files / Prog / M / LSC XCMD 2.0.cpt / HyperXCmd_LSC.h next >
Text File  |  1990-10-19  |  28KB  |  864 lines

  1. /*
  2.     HyperXCmd.h  Definitions for calling all standard 
  3.     HyperCard callback routines from C.
  4.     ©Apple Computer, Inc. 1987-1990
  5.     All Rights Reserved.
  6.  
  7.     Hacked about for LightSpeed/Think C by Nigel Perry, 1988-1990
  8.     
  9.     Typedef's changed a little.
  10.     Callbacks defined as inline macros not external Pascal procedures.
  11. */
  12.  
  13. #ifndef  _HyperXCmd_LSC_
  14. #define _HyperXCmd_LSC_
  15.  
  16. /* Unlike the old days, we have to make sure we have some definitions first… */
  17.  
  18. #include <MacTypes.h>
  19. #include <EventMgr.h>
  20. #include <MenuMgr.h>
  21. #include <TextEdit.h>
  22. #include <PackageMgr.h>
  23.  
  24. /*result codes */
  25. #define    xresSucc         0
  26. #define    xresFail         1 
  27. #define    xresNotImp         2 
  28.   
  29. /* request codes */
  30. #define    xreqSendCardMessage        1 
  31. #define    xreqEvalExpr            2 
  32. #define    xreqStringLength        3 
  33. #define    xreqStringMatch            4 
  34. #define xreqSendHCMessage        5
  35. #define    xreqZeroBytes             6 
  36. #define    xreqPasToZero            7 
  37. #define    xreqZeroToPas            8 
  38. #define    xreqStrToLong            9 
  39. #define    xreqStrToNum            10 
  40. #define    xreqStrToBool            11 
  41. #define    xreqStrToExt            12 
  42. #define    xreqLongToStr            13 
  43. #define    xreqNumToStr            14 
  44. #define    xreqNumToHex            15 
  45. #define    xreqBoolToStr            16 
  46. #define    xreqExtToStr            17 
  47. #define    xreqGetGlobal            18 
  48. #define    xreqSetGlobal            19 
  49. #define    xreqGetFieldByName        20 
  50. #define    xreqGetFieldByNum        21 
  51. #define    xreqGetFieldByID        22 
  52. #define    xreqSetFieldByName        23 
  53. #define    xreqSetFieldByNum        24 
  54. #define    xreqSetFieldByID        25 
  55. #define    xreqStringEqual           26 
  56. #define    xreqReturnToPas           27 
  57. #define    xreqScanToReturn          28 
  58. #define    xreqScanToZero            39   /* was supposed to be 29!  Oops! */
  59.  
  60. /* new HyperCard 2.0 callbacks */
  61.  
  62. #define xreqFormatScript        31
  63. #define    xreqZeroTermHandle        32
  64. #define xreqPrintTE                33
  65. #define xreqSendHCEvent            34
  66. #define xreqHCWordBreakProc        35
  67. #define xreqBeginXSound            36
  68. #define xreqEndXSound            37
  69. #define    xreqRunHandler            38
  70.  
  71. #define xreqGetXResInfo            40
  72. #define xreqGetFilePath            41
  73. #define xreqFrontDocWindow        42
  74. #define xreqPointToStr            43
  75. #define xreqRectToStr            44
  76. #define xreqStrToPoint            45
  77. #define xreqStrToRect            46
  78. #define xreqGetFieldTE            47
  79. #define xreqSetFieldTE            48
  80. #define xreqGetObjectName        49
  81. #define xreqGetObjectScript        50
  82. #define xreqSetObjectScript        51
  83. #define xreqStackNameToNum        52
  84. #define xreqNotify                53
  85. #define    xreqShowHCAlert            54
  86.  
  87. #define xreqNewXWindow            100
  88. #define xreqGetNewXWindow        100        /* params set differently */
  89. #define    xreqCloseXWindow        101
  90. #define xreqSetXWIdleTime        102
  91. #define xreqXWHasInterruptCode    103
  92. #define xreqRegisterXWMenu        104
  93. #define xreqBeginXWEdit            105        /* param[1] = 1 */
  94. #define xreqEndXWEdit            105        /* param[1] = 0 */
  95. #define xreqSaveXWScript        106
  96. #define xreqGetCheckPoints        107
  97. #define xreqSetCheckPoints        108
  98. #define xreqXWAllowReEntrancy    109
  99. #define xreqSendWindowMessage    110
  100. #define xreqHideHCPalettes        111
  101. #define xreqShowHCPalettes        112
  102. #define xreqXWAlwaysMoveHigh    113
  103.  
  104. #define xreqGoScript            200
  105. #define xreqStepScript            201
  106. #define xreqAbortScript            202
  107. #define xreqCountHandlers        203
  108. #define xreqGetHandlerInfo        204
  109. #define    xreqGetVarInfo            205
  110. #define xreqSetVarInfo            206
  111. #define xreqGetStackCrawl        207
  112. #define xreqTraceScript            208
  113.  
  114. /* XCMDBlock constants for event.what... */
  115. #define xOpenEvt                1000    /* the first event after you are created */
  116. #define xCloseEvt                1001    /* your window is being forced close (Quit?) */
  117. #define xGiveUpEditEvt            1002    /* you are losing Edit... */
  118. #define xGiveUpSoundEvt            1003    /* you are losing the sound channel... */
  119. #define xHidePalettesEvt        1004    /* someone called HideHCPalettes */
  120. #define xShowPalettesEvt        1005    /* someone called ShowHCPalettes */
  121. #define xEditUndo                1100    /* Edit——Undo */
  122. #define xEditCut                1102    /* Edit——Cut */
  123. #define xEditCopy                1103    /* Edit——Copy */
  124. #define xEditPaste                1104    /* Edit——Paste */
  125. #define xEditClear                1105    /* Edit——Clear */
  126. #define xSendEvt                1200    /* script has sent you a message (text) */
  127. #define xSetPropEvt                1201    /* set a window property */
  128. #define xGetPropEvt                1202    /* get a window property */
  129. #define xCursorWithin            1300    /* cursor is within the window */
  130. #define xMenuEvt                1400    /* user has selected an item in your menu */
  131. #define xMBarClickedEvt            1401    /* a menu is about to be shown--update if needed */
  132. #define xShowWatchInfoEvt        1501    /* for variable and message watchers */
  133. #define xScriptErrorEvt            1502    /* place the insertion point */
  134. #define xDebugErrorEvt            1503    /* user clicked "Debug" at a complaint */
  135. #define xDebugStepEvt            1504    /* hilite the line */
  136. #define xDebugTraceEvt            1505    /* same as step but tracing */
  137. #define xDebugFinishedEvt        1506    /* script ended */
  138.  
  139. #define paletteProc                2048    /* Windoid with grow box */
  140. #define palNoGrowProc            2052    /* standard Windoid defproc */
  141. #define palZoomProc                2056    /* Windoid with zoom and grow */
  142. #define palZoomNoGrow            2060    /* Windoid with zoom and no grow */
  143. #define hasZoom                    8
  144. #define hasTallTBar                2
  145. #define toggleHilite            1
  146.  
  147. #define maxCachedChecks            16        /* maximum number of checkpoints in a script */
  148.  
  149. /* paramCount is set to these constants when first calling special XThings */
  150. #define xMessageWatcherID        = -2;
  151. #define xVariableWatcherID        = -3;
  152. #define xScriptEditorID            = -4;
  153. #define xDebuggerID                = -5;
  154.  
  155. /* XTalkObjectPtr->objectKind values */
  156. #define stackObj                1
  157. #define bkgndObj                2
  158. #define cardObj                    3
  159. #define fieldObj                4
  160. #define buttonObj                5
  161.  
  162. /* Alert IDs */
  163. #define errorDlgID                1    /* 1:OK */
  164. #define confirmDlgID            2    /* 1:OK, 2:Cancel */
  165. #define confirmDelDlgID            3    /* 1:Cancel, 2:Delete */
  166. #define yesNoCancelDlgID        4    /* 1:Yes, 2:Cancel, 3:No */
  167.  
  168. typedef struct XCmdBlock
  169. {    short    paramCount;        /* If = -1 then new use for XWindoids */     
  170.     Handle  params[16];
  171.     Handle  returnValue;      
  172.     Boolean    passFlag; 
  173.       
  174.     char *    entryPoint;        /* to call back to HyperCard */
  175.     short    request;  
  176.     short    result;  
  177.     long    inArgs[8];
  178.     long    outArgs[4];
  179. } XCmdBlock, *XCmdBlockPtr, *XCmdPtr;
  180.    
  181. typedef struct XWEventInfo
  182. {    EventRecord event;
  183.     WindowPtr eventWindow;
  184.     long eventParams[9];
  185.     Handle eventResult;
  186. } XWEventInfo, *XWEventInfoPtr;
  187.  
  188. typedef struct XTalkObject
  189. {    short objectKind;        /* stack, bkgnd, card, field, or button */
  190.     long stackNum;            /* reference number of the source stack */
  191.     long bkgndID;
  192.     long cardID;
  193.     long buttonID;
  194.     long fieldID;
  195. } XTalkObject, *XTalkObjectPtr;
  196.  
  197. typedef struct CheckPts
  198. {    short checks[maxCachedChecks];
  199. } CheckPts, *CheckPtPtr, **CheckPtHandle;
  200.  
  201. typedef Byte Str31[32];
  202. typedef Str31 *Str31Ptr;
  203.  
  204. typedef void (*MyProcPtr) ();
  205.  
  206. /* Send a HyperCard message (a command with arguments) to the current card.
  207.    msg is a pointer to a pascal format string.  */
  208. #define SendCardMessage(paramPtr,msg) \
  209. (    paramPtr->inArgs[0] = (long)msg, \
  210.     paramPtr->request = xreqSendCardMessage, \
  211.     (*(MyProcPtr) (paramPtr->entryPoint))() \
  212. )
  213.  
  214. /*    Evaluate a HyperCard expression and return the answer.  The answer is
  215.     a handle to a zero-terminated string. */
  216. #define EvalExpr(paramPtr,expr) \
  217. ( \
  218.     paramPtr->inArgs[0] = (long)expr, \
  219.     paramPtr->request = xreqEvalExpr, \
  220.     (*(MyProcPtr) (paramPtr->entryPoint))(), \
  221.     (Handle)paramPtr->outArgs[0] \
  222. )
  223.  
  224. /* Count the characters from where strPtr points until the next zero byte. 
  225.    Does not count the zero itself.  strPtr must be a zero-terminated string. */
  226. #define StringLength(paramPtr,strPtr) \
  227. ( \
  228.     paramPtr->inArgs[0] = (long)strPtr, \
  229.     paramPtr->request = xreqStringLength, \
  230.     (*(MyProcPtr) (paramPtr->entryPoint))(), \
  231.     (long)paramPtr->outArgs[0] \
  232. )
  233.  
  234. /* Perform case-insensitive match looking for pattern anywhere in
  235.    target, returning a pointer to first character of the first match,
  236.    in target or NIL if no match found.  pattern is a pascal string,
  237.    and target is a zero-terminated string. */
  238. #define StringMatch(paramPtr,pattern,target) \
  239. ( \
  240.     paramPtr->inArgs[0] = (long)pattern, \
  241.     paramPtr->inArgs[1] = (long)target, \
  242.     paramPtr->request = xreqStringMatch, \
  243.     (*(MyProcPtr) (paramPtr->entryPoint))(), \
  244.     (Ptr)paramPtr->outArgs[0] \
  245. )
  246.  
  247.     /* Send a HyperCard message (a command with arguments) to HyperCard.
  248.        msg is a pointer to a pascal format string.  */
  249. #define SendHCMessage(paramPtr,msg) \
  250. (    paramPtr->inArgs[0] = (long)msg, \
  251.     paramPtr->request = xreqSendHCMessage, \
  252.     (*(MyProcPtr) (paramPtr->entryPoint))() \
  253. )
  254.  
  255. /* Write zeros into memory starting at destPtr and going for longCount 
  256.    number of bytes. */
  257. #define ZeroBytes(paramPtr,dstPtr,longCount) \
  258. ( \
  259.     paramPtr->inArgs[0] = (long)dstPtr, \
  260.     paramPtr->inArgs[1] = longCount, \
  261.     paramPtr->request = xreqZeroBytes, \
  262.     (*(MyProcPtr) (paramPtr->entryPoint))() \
  263. )
  264.  
  265. /* Convert a pascal string to a zero-terminated string.  Returns a handle
  266.    to a new zero-terminated string.  The caller must dispose the handle.
  267.    You'll need to do this for any result or argument you send from 
  268.    your XCMD to HyperTalk. */
  269. #define PasToZero(paramPtr,pasStr) \
  270. ( \
  271.     paramPtr->inArgs[0] = (long)pasStr, \
  272.     paramPtr->request = xreqPasToZero, \
  273.     (*(MyProcPtr) (paramPtr->entryPoint))(), \
  274.     (Handle)paramPtr->outArgs[0] \
  275. )
  276.  
  277. /* Fill the pascal string with the contents of the zero-terminated
  278.    string.  You create the pascal string and pass it in as a VAR 
  279.    parameter.  Useful for converting the arguments of any XCMD to 
  280.    pascal strings. */
  281. #define ZeroToPas(paramPtr,zeroStr,pasStr) \
  282. ( \
  283.     paramPtr->inArgs[0] = (long)zeroStr, \
  284.     paramPtr->inArgs[1] = (long)pasStr, \
  285.     paramPtr->request = xreqZeroToPas, \
  286.     (*(MyProcPtr) (paramPtr->entryPoint))() \
  287. )
  288.  
  289. /* Convert a string of ASCII decimal digits to an unsigned long integer. */
  290. #define StrToLong(paramPtr,strPtr) \
  291. ( \
  292.     paramPtr->inArgs[0] = (long)strPtr, \
  293.     paramPtr->request = xreqStrToLong, \
  294.     (*(MyProcPtr) (paramPtr->entryPoint))(), \
  295.     (long)paramPtr->outArgs[0] \
  296. )
  297.  
  298. /* Convert a string of ASCII decimal digits to a signed long integer.
  299.    Negative sign is allowed. */
  300. #define StrToNum(paramPtr,str) \
  301. ( \
  302.     paramPtr->inArgs[0] = (long)str, \
  303.     paramPtr->request = xreqStrToNum, \
  304.     (*(MyProcPtr) (paramPtr->entryPoint))(), \
  305.     paramPtr->outArgs[0] \
  306. )
  307.  
  308. /* Convert the pascal strings 'true' and 'false' to booleans. */
  309. #define StrToBool(paramPtr,str) \
  310. ( \
  311.     paramPtr->inArgs[0] = (long)str, \
  312.     paramPtr->request = xreqStrToBool, \
  313.     (*(MyProcPtr) (paramPtr->entryPoint))(), \
  314.     (Boolean)paramPtr->outArgs[0] \
  315. )
  316.  
  317.  /* Convert a string of ASCII decimal digits to an extended long integer.
  318.     Instead of returning a new extended, as pascal does, it expects you 
  319.     to create myext and pass it in to be filled. */
  320. #define StrToExt(paramPtr,str,myext) \
  321. ( \
  322.     paramPtr->inArgs[0] = (long)str, \
  323.     paramPtr->inArgs[1] = (long)myext, \
  324.     paramPtr->request = xreqStrToExt, \
  325.     (*(MyProcPtr) (paramPtr->entryPoint))() \
  326. )
  327.  
  328.  /* Convert an unsigned long integer to a pascal string.  Instead of 
  329.     returning a new string, as pascal does, it expects you to 
  330.     create mystr and pass it in to be filled. */
  331. #define LongToStr(paramPtr,posNum,mystr) \
  332. ( \
  333.     paramPtr->inArgs[0] = (long)posNum, \
  334.     paramPtr->inArgs[1] = (long)mystr, \
  335.     paramPtr->request = xreqLongToStr, \
  336.     (*(MyProcPtr) (paramPtr->entryPoint))() \
  337. )
  338.  
  339.  /* Convert a signed long integer to a pascal string.  Instead of 
  340.     returning a new string, as pascal does, it expects you to 
  341.     create mystr and pass it in to be filled. */
  342. #define NumToStr(paramPtr,num,mystr) \
  343. ( \
  344.     paramPtr->inArgs[0] = num, \
  345.     paramPtr->inArgs[1] = (long)mystr, \
  346.     paramPtr->request = xreqNumToStr, \
  347.     (*(MyProcPtr) (paramPtr->entryPoint))() \
  348. )
  349.  
  350. /* Convert an unsigned long integer to a hexadecimal number and put it
  351.    into a pascal string.  Instead of returning a new string, as 
  352.    pascal does, it expects you to create mystr and pass it in to be filled. */
  353. #define NumToHex(paramPtr,num,nDigits,mystr) \
  354. ( \
  355.     paramPtr->inArgs[0] = num, \
  356.     paramPtr->inArgs[1] = nDigits, \
  357.     paramPtr->inArgs[2] = (long)mystr, \
  358.     paramPtr->request = xreqNumToHex, \
  359.     (*(MyProcPtr) (paramPtr->entryPoint))() \
  360. )
  361.  
  362.  /* Convert a boolean to 'true' or 'false'.  Instead of returning 
  363.     a new string, as pascal does, it expects you to create mystr
  364.     and pass it in to be filled. */
  365. #define BoolToStr(paramPtr,bool,mystr) \
  366. ( \
  367.     paramPtr->inArgs[0] = (long)bool, \
  368.     paramPtr->inArgs[1] = (long)mystr, \
  369.     paramPtr->request = xreqBoolToStr, \
  370.     (*(MyProcPtr) (paramPtr->entryPoint))() \
  371. )
  372.  
  373.  /* Convert an extended long integer to decimal digits in a string.  
  374.     Instead of returning a new string, as pascal does, it expects 
  375.     you to create mystr and pass it in to be filled. */
  376. #define ExtToStr(paramPtr,myext,mystr) \
  377. ( \
  378.     paramPtr->inArgs[0] = (long)myext, \
  379.     paramPtr->inArgs[1] = (long)mystr, \
  380.     paramPtr->request = xreqExtToStr, \
  381.     (*(MyProcPtr) (paramPtr->entryPoint))() \
  382. )
  383.  
  384. /* Return a handle to a zero-terminated string containing the value of 
  385.    the specified HyperTalk global variable. */
  386. #define GetGlobal(paramPtr,globName) \
  387. ( \
  388.     paramPtr->inArgs[0] = (long)globName, \
  389.     paramPtr->request = xreqGetGlobal, \
  390.     (*(MyProcPtr) (paramPtr->entryPoint))(), \
  391.     (Handle)paramPtr->outArgs[0] \
  392. )
  393.  
  394. /* Set the value of the specified HyperTalk global variable to be
  395.    the zero-terminated string in globValue.  The contents of the 
  396.    Handle are copied, so you must still dispose it afterwards.  */
  397. #define SetGlobal(paramPtr,globName,globValue) \
  398. ( \
  399.     paramPtr->inArgs[0] = (long)globName, \
  400.     paramPtr->inArgs[1] = (long)globValue, \
  401.     paramPtr->request = xreqSetGlobal, \
  402.     (*(MyProcPtr) (paramPtr->entryPoint))() \
  403. )
  404.  
  405. /* Return a handle to a zero-terminated string containing the value of 
  406.    field fieldName on the current card.  You must dispose the handle. */
  407. #define GetFieldByName(paramPtr,cardFieldFlag,fieldName) \
  408. ( \
  409.     paramPtr->inArgs[0] = (long)cardFieldFlag, \
  410.     paramPtr->inArgs[1] = (long)fieldName, \
  411.     paramPtr->request = xreqGetFieldByName, \
  412.     (*(MyProcPtr) (paramPtr->entryPoint))(), \
  413.     (Handle)paramPtr->outArgs[0] \
  414. )
  415.  
  416. /* Return a handle to a zero-terminated string containing the value of 
  417.    field fieldNum on the current card.  You must dispose the handle. */
  418. #define GetFieldByNum(paramPtr,cardFieldFlag,fieldNum) \
  419. ( \
  420.     paramPtr->inArgs[0] = (long)cardFieldFlag, \
  421.     paramPtr->inArgs[1] = fieldNum, \
  422.     paramPtr->request = xreqGetFieldByNum, \
  423.     (*(MyProcPtr) (paramPtr->entryPoint))(), \
  424.     (Handle)paramPtr->outArgs[0] \
  425. )
  426.  
  427. /* Return a handle to a zero-terminated string containing the value of 
  428.    the field whise ID is fieldID.  You must dispose the handle. */
  429. #define GetFieldByID(paramPtr,cardFieldFlag,fieldID) \
  430. ( \
  431.     paramPtr->inArgs[0] = (long)cardFieldFlag, \
  432.     paramPtr->inArgs[1] = fieldID, \
  433.     paramPtr->request = xreqGetFieldByID, \
  434.     (*(MyProcPtr) (paramPtr->entryPoint))(), \
  435.     (Handle)paramPtr->outArgs[0] \
  436. )
  437.  
  438. /* Set the value of field fieldName to be the zero-terminated string 
  439.    in fieldVal.  The contents of the Handle are copied, so you must 
  440.    still dispose it afterwards. */
  441. #define SetFieldByName(paramPtr,cardFieldFlag,fieldName,fieldVal) \
  442. ( \
  443.     paramPtr->inArgs[0] = (long)cardFieldFlag, \
  444.     paramPtr->inArgs[1] = (long)fieldName, \
  445.     paramPtr->inArgs[2] = (long)fieldVal, \
  446.     paramPtr->request = xreqSetFieldByName, \
  447.     (*(MyProcPtr) (paramPtr->entryPoint))() \
  448. )
  449.  
  450. /* Set the value of field fieldNum to be the zero-terminated string 
  451.    in fieldVal.  The contents of the Handle are copied, so you must 
  452.    still dispose it afterwards. */
  453. #define SetFieldByNum(paramPtr,cardFieldFlag,fieldNum,fieldVal) \
  454. ( \
  455.     paramPtr->inArgs[0] = (long)cardFieldFlag, \
  456.     paramPtr->inArgs[1] = fieldNum, \
  457.     paramPtr->inArgs[2] = (long)fieldVal, \
  458.     paramPtr->request = xreqSetFieldByNum, \
  459.     (*(MyProcPtr) (paramPtr->entryPoint))() \
  460. )
  461.  
  462. /* Set the value of the field whose ID is fieldID to be the zero-
  463.    terminated string in fieldVal.  The contents of the Handle are 
  464.    copied, so you must still dispose it afterwards. */
  465. #define SetFieldByID(paramPtr,cardFieldFlag,fieldID,fieldVal) \
  466. ( \
  467.     paramPtr->inArgs[0] = (long)cardFieldFlag, \
  468.     paramPtr->inArgs[1] = fieldID, \
  469.     paramPtr->inArgs[2] = (long)fieldVal, \
  470.     paramPtr->request = xreqSetFieldByID, \
  471.     (*(MyProcPtr) (paramPtr->entryPoint))() \
  472. )
  473.  
  474. /* Return true if the two strings have the same characters.  
  475.    Case insensitive compare of the strings. */
  476. #define StringEqual(paramPtr,str1,str2) \
  477. ( \
  478.     paramPtr->inArgs[0] = (long)str1, \
  479.     paramPtr->inArgs[1] = (long)str2, \
  480.     paramPtr->request = xreqStringEqual, \
  481.     (*(MyProcPtr) (paramPtr->entryPoint))(), \
  482.     (Boolean)paramPtr->outArgs[0] \
  483. )
  484.  
  485. /* zeroStr points into a zero-terminated string.  Collect the 
  486.    characters from there to the next carriage Return and return 
  487.    them in the pascal string pasStr.  If a Return is not found, 
  488.    collect chars until the end of the string. */
  489. #define ReturnToPas(paramPtr,zeroStr,pasStr) \
  490. ( \
  491.     paramPtr->inArgs[0] = (long)zeroStr, \
  492.     paramPtr->inArgs[1] = (long)pasStr, \
  493.     paramPtr->request = xreqReturnToPas, \
  494.     (*(MyProcPtr) (paramPtr->entryPoint))() \
  495. )
  496.  
  497. /* Move the pointer scanPtr along a zero-terminated 
  498.    string until it points at a Return character
  499.    or a zero byte.  */
  500. #define ScanToReturn(paramPtr,scanHndl) \
  501. ( \
  502.     paramPtr->inArgs[0] = (long)scanHndl, \
  503.     paramPtr->request = xreqScanToReturn, \
  504.     (*(MyProcPtr) (paramPtr->entryPoint))() \
  505. )
  506.  
  507. /* Move the pointer scanPtr along a zero-terminated 
  508.    string until it points at a zero byte.  */
  509. #define ScanToZero(paramPtr,scanHndl) \
  510. ( \
  511.     paramPtr->inArgs[0] = (long)scanHndl, \
  512.     paramPtr->request = xreqScanToZero, \
  513.     (*(MyProcPtr) (paramPtr->entryPoint))() \
  514. )
  515.  
  516. /* New HyperCard 2.0 callbacks */
  517.  
  518. #define RunHandler(paramPtr, handler) \
  519. (    paramPtr->inArgs[0] = (long)handler, \
  520.     paramPtr->request = xreqRunHandler, \
  521.     (*(MyProcPtr) (paramPtr->entryPoint))() \
  522. )
  523.  
  524. #define ZeroTermHandle(paramPtr, hndl) \
  525. (    paramPtr->inArgs[0] = (long)hndl, \
  526.     paramPtr->request = xreqZeroTermHandle, \
  527.     (*(MyProcPtr) (paramPtr->entryPoint))() \
  528. )
  529.  
  530. #define PointToStr(paramPtr, pt, str) \
  531. (    paramPtr->inArgs[0] = (long)pt, \
  532.     paramPtr->inArgs[1] = (long)str, \
  533.     paramPtr->request = xreqPointToStr, \
  534.     (*(MyProcPtr) (paramPtr->entryPoint))() \
  535. )
  536.  
  537. #define RectToStr(paramPtr, rct, str) \
  538. (    paramPtr->inArgs[0] = (long)rct, \
  539.     paramPtr->inArgs[1] = (long)str, \
  540.     paramPtr->request = xreqRectToStr, \
  541.     (*(MyProcPtr) (paramPtr->entryPoint))() \
  542. )
  543.  
  544. #define StrToPoint(paramPtr, str, pt) \
  545. (    paramPtr->inArgs[0] = (long)str, \
  546.     paramPtr->inArgs[1] = (long)pt, \
  547.     paramPtr->request = xreqStrToPoint, \
  548.     (*(MyProcPtr) (paramPtr->entryPoint))() \
  549. )
  550.  
  551. #define StrToRect(paramPtr, str, rct) \
  552. (    paramPtr->inArgs[0] = (long)str, \
  553.     paramPtr->inArgs[1] = (long)rct, \
  554.     paramPtr->request = xreqStrToRect, \
  555.     (*(MyProcPtr) (paramPtr->entryPoint))() \
  556. )
  557.  
  558. #define GetFieldTE(paramPtr, cardFieldFlag, fieldID,fieldNum, fieldNamePtr) \
  559. (    paramPtr->inArgs[0] = (long)cardFieldFlag, \
  560.     paramPtr->inArgs[1] = (long)fieldID, \
  561.     paramPtr->inArgs[2] = (long)fieldNum, \
  562.     paramPtr->inArgs[3] = (long)fieldTE, \
  563.     paramPtr->request = xreqGetFieldTE, \
  564.     (*(MyProcPtr) (paramPtr->entryPoint))(), \
  565.     (TEHandle)paramPtr->outArgs[0] \
  566. )
  567.  
  568. #define SetFieldTE(paramPtr, cardFieldFlag, fieldID,fieldNum, fieldNamePtr, fieldTE) \
  569. (    paramPtr->inArgs[0] = (long)cardFieldFlag, \
  570.     paramPtr->inArgs[1] = (long)fieldID, \
  571.     paramPtr->inArgs[2] = (long)fieldNum, \
  572.     paramPtr->inArgs[3] = (long)fieldNamePtr, \
  573.     paramPtr->inArgs[4] = (long)fieldTE, \
  574.     paramPtr->request = xreqSetFieldTE, \
  575.     (*(MyProcPtr) (paramPtr->entryPoint))() \
  576. )
  577.  
  578. #define BeginXSound(paramPtr, window) \
  579. (    paramPtr->inArgs[0] = (long)window, \
  580.     paramPtr->request = xreqBeginXSound, \
  581.     (*(MyProcPtr) (paramPtr->entryPoint))() \
  582. )
  583.  
  584. #define EndXSound(paramPtr) \
  585. (    paramPtr->request = xreqEndXSound, \
  586.     (*(MyProcPtr) (paramPtr->entryPoint))() \
  587. )
  588.  
  589. #define GetFilePath(paramPtr, fileName, numTypes, typeList, askUser, fileType, fullName) \
  590. (    paramPtr->inArgs[0] = (long)fileName, \
  591.     paramPtr->inArgs[1] = (long)numTypes, \
  592.     paramPtr->inArgs[2] = (long)typeList, \
  593.     paramPtr->inArgs[3] = (long)askUser, \
  594.     paramPtr->inArgs[4] = (long)fileType, \
  595.     paramptr->inArgs[5] = (long)fullName, \
  596.     paramPtr->request = xreqGetFilePath, \
  597.     (*(MyProcPtr) (paramPtr->entryPoint))(), \
  598.     (paramPtr->result == 0 ? false : (paramPtr->result = 0, true)) \
  599. )
  600.  
  601. #define GetXResInfo(paramPtr, resFile, resID, rType, name) \
  602. (    paramPtr->inArgs[0] = (long)resFile, \
  603.     paramPtr->inArgs[1] = (long)resID, \
  604.     paramPtr->inArgs[2] = (long)rType, \
  605.     paramPtr->inArgs[3] = (long)name, \
  606.     paramPtr->request = xreqGetXResInfo, \
  607.     (*(MyProcPtr) (paramPtr->entryPoint))() \
  608. )
  609.  
  610. #define Notify(paramPtr) \
  611. (    paramPtr->request = xreqNotify, \
  612.     (*(MyProcPtr) (paramPtr->entryPoint))() \
  613. )
  614.  
  615. #define SendHCEvent(paramPtr, event) \
  616. (    paramPtr->inArgs[0] = (long)event, \
  617.     paramPtr->request = xreqSendHCEvent, \
  618.     (*(MyProcPtr) (paramPtr->entryPoint))() \
  619. )
  620.  
  621. #define SendWindowMessage(paramPtr, windPtr, windowName, msg) \
  622. (    paramPtr->inArgs[0] = (long)windPtr, \
  623.     paramPtr->inArgs[1] = (long)windowName, \
  624.     paramPtr->inArgs[2] = (long)msg, \
  625.     paramPtr->request = xreqSendWindowMessage, \
  626.     (*(MyProcPtr) (paramPtr->entryPoint))() \
  627. )
  628.  
  629. #define FrontDocWindow(paramPtr) \
  630. (    paramPtr->request = xreqFrontDocWindow, \
  631.     (*(MyProcPtr) (paramPtr->entryPoint))(), \
  632.     (WindowPtr)paramPtr->outArgs[0] \
  633. )
  634.  
  635. #define StackNameToNum(paramPtr, stackName) \
  636. (    paramPtr->inArgs[0] = (long)stackName, \
  637.     paramPtr->request = xreqStackNameToNum, \
  638.     (*(MyProcPtr) (paramPtr->entryPoint))(), \
  639.     (long)paramPtr->outArgs[0] \
  640. )
  641.  
  642. #define ShowHCAlert(paramPtr, dlgID, promptStr) \
  643. (    paramPtr->inArgs[0] = (long)dlgID, \
  644.     paramPtr->inArgs[1] = (long)promptStr, \
  645.     paramPtr->request = xreqShowHCAlert, \
  646.     (*(MyProcPtr) (paramPtr->entryPoint))(), \
  647.     (int)paramPtr->outArgs[0] \
  648. )
  649.  
  650. #define NewXWindow(paramPtr, boundsRect, title, visible, procID, color, floating) \
  651. (    paramPtr->inArgs[0] = (long)color, \
  652.     paramPtr->inArgs[1] = (long)visible, \
  653.     paramPtr->inArgs[2] = 0, \
  654.     paramPtr->inArgs[3] = 0, \
  655.     paramPtr->inArgs[4] = (long)procID, \
  656.     paramPtr->inArgs[5] = (long)boundsRect, \
  657.     paramPtr->inArgs[6] = (long)title, \
  658.     paramPtr->inArgs[7] = (long)floating, \
  659.     paramPtr->request = xreqNewXWindow, \
  660.     (*(MyProcPtr) (paramPtr->entryPoint))(), \
  661.     (WindowPtr)paramPtr->outArgs[0] \
  662. )
  663.  
  664. #define GetNewXWindow(paramPtr, templateType, templateID, color, floating) \
  665. (    paramPtr->inArgs[0] = (long)color, \
  666.     paramPtr->inArgs[2] = (long)templateType, \
  667.     paramPtr->inArgs[3] = (long)templateID, \
  668.     paramPtr->inArgs[7] = (long)floating, \
  669.     paramPtr->request = xreqNewXWindow, \
  670.     (*(MyProcPtr) (paramPtr->entryPoint))(), \
  671.     (WindowPtr)paramPtr->outArgs[0] \
  672. )
  673.  
  674. #define CloseXWindow(paramPtr, window) \
  675. (    paramPtr->inArgs[0] = (long)window, \
  676.     paramPtr->request = xreqCloseXWindow, \
  677.     (*(MyProcPtr) (paramPtr->entryPoint))() \
  678. )
  679.  
  680. #define HideHCPalettes(paramPtr) \
  681. (    paramPtr->request = xreqHideHCPalettes, \
  682.     (*(MyProcPtr) (paramPtr->entryPoint))() \
  683. )
  684.  
  685. #define ShowHCPalettes(paramPtr) \
  686. (    paramPtr->request = xreqShowHCPalettes, \
  687.     (*(MyProcPtr) (paramPtr->entryPoint))() \
  688. )
  689.  
  690. #define RegisterXWMenu(paramPtr, window, menu, registering) \
  691. (    paramPtr->inArgs[0] = (long)window, \
  692.     paramPtr->inArgs[1] = (long)menu, \
  693.     paramPtr->inArgs[2] = (long)registering, \
  694.     paramPtr->request = xreqRegisterXWMenu, \
  695.     (*(MyProcPtr) (paramPtr->entryPoint))() \
  696. )
  697.  
  698. #define SetXWIdleTime(paramPtr, window, interval) \
  699. (    paramPtr->inArgs[0] = (long)window, \
  700.     paramPtr->inArgs[1] = (long)interval, \
  701.     paramPtr->request = xreqSetXWIdleTime, \
  702.     (*(MyProcPtr) (paramPtr->entryPoint))() \
  703. )
  704.  
  705. #define XWHasInterruptCode(paramPtr, window, haveCode) \
  706. (    paramPtr->inArgs[0] = (long)window, \
  707.     paramPtr->inArgs[1] = (long)haveCode, \
  708.     paramPtr->request = xreqXWHasInterruptCode, \
  709.     (*(MyProcPtr) (paramPtr->entryPoint))() \
  710. )
  711.  
  712. #define XWAlwaysMoveHigh(paramPtr, window, moveHigh) \
  713. (    paramPtr->inArgs[0] = (long)window, \
  714.     paramPtr->inArgs[1] = (long)moveHigh, \
  715.     paramPtr->request = xreqXWAlwaysMoveHigh, \
  716.     (*(MyProcPtr) (paramPtr->entryPoint))() \
  717. )
  718.  
  719. #define XWAllowReEntrancy(paramPtr, window, allowSysEvts, allowHCEvts) \
  720. (    paramPtr->inArgs[0] = (long)window, \
  721.     paramPtr->inArgs[1] = (long)allowSysEvts, \
  722.     paramPtr->inArgs[2] = (long)allowHCEvts, \
  723.     paramPtr->request = xreqXWAllowReEntrancy, \
  724.     (*(MyProcPtr) (paramPtr->entryPoint))() \
  725. )
  726.  
  727. #define BeginXWEdit(paramPtr, window) \
  728. (    paramPtr->inArgs[0] = (long)window, \
  729.     paramPtr->inArgs[1] = 1, \
  730.     paramPtr->request = xreqBeginXWEdit, \
  731.     (*(MyProcPtr) (paramPtr->entryPoint))() \
  732. )
  733.  
  734. #define EndXWEdit(paramPtr, window) \
  735. (    paramPtr->inArgs[0] = (long)window, \
  736.     paramPtr->inArgs[1] = 0, \
  737.     paramPtr->request = xreqEndXWEdit, \
  738.     (*(MyProcPtr) (paramPtr->entryPoint))() \
  739. )
  740.  
  741. #define HCWordBreakProc(paramPtr) \
  742. (    paramPtr->request = xreqHCWordBreakProc, \
  743.     (*(MyProcPtr) (paramPtr->entryPoint))(), \
  744.     (ProcPtr)paramPtr->outArgs[0] \
  745. )
  746.  
  747. #define PrintTEHandle(paramPtr, hTE, header) \
  748. (    paramPtr->inArgs[0] = (long)hTE, \
  749.     paramPtr->inArgs[1] = (long)header, \
  750.     paramPtr->request = xreqPrintTEHandle, \
  751.     (*(MyProcPtr) (paramPtr->entryPoint))() \
  752. )
  753.  
  754. #define GetCheckPoints(paramPtr) \
  755. (    paramPtr->request = xreqGetCheckPoints, \
  756.     (*(MyProcPtr) (paramPtr->entryPoint))(), \
  757.     (CheckPtHandle)paramPtr->outArgs[0] \
  758. )
  759.  
  760. #define SetCheckPoints(paramPtr, checkLines) \
  761. (    paramPtr->inArgs[0] = (long)checkLines, \
  762.     paramPtr->request = xreqSetCheckPoints, \
  763.     (*(MyProcPtr) (paramPtr->entryPoint))() \
  764. )
  765.  
  766. #define FormatScript(paramPtr, scriptHndl,  insertionPoint, quickFormat) \
  767. (    paramPtr->inArgs[0] = (long)scriptHndl, \
  768.     paramPtr->inArgs[1] = (long) insertionPoint, \
  769.     paramPtr->inArgs[2] = (long)quickFormat, \
  770.     paramPtr->request = xreqFormatScript, \
  771.     (*(MyProcPtr) (paramPtr->entryPoint))() \
  772. )
  773.  
  774. #define SaveXWScript(paramPtr, scriptHndl) \
  775. (    paramPtr->inArgs[0] = (long)scriptHndl, \
  776.     paramPtr->request = xreqSaveXWScript, \
  777.     (*(MyProcPtr) (paramPtr->entryPoint))() \
  778. )
  779.  
  780. #define GetObjectName(paramPtr, object, objName) \
  781. (    paramPtr->inArgs[0] = (long)object, \
  782.     paramPtr->inArgs[1] = (long)objName, \
  783.     paramPtr->request = xreqGetObjectName, \
  784.     (*(MyProcPtr) (paramPtr->entryPoint))() \
  785. )
  786.  
  787. #define GetObjectScript(paramPtr, object, scriptHndl) \
  788. (    paramPtr->inArgs[0] = (long)object, \
  789.     paramPtr->inArgs[1] = (long)scriptHndl, \
  790.     paramPtr->request = xreqGetObjectScript, \
  791.     (*(MyProcPtr) (paramPtr->entryPoint))() \
  792. )
  793.  
  794. #define SetObjectScript(paramPtr, object, scriptHndl) \
  795. (    paramPtr->inArgs[0] = (long)object, \
  796.     paramPtr->inArgs[1] = (long)scriptHndl, \
  797.     paramPtr->request = xreqSetObjectScript, \
  798.     (*(MyProcPtr) (paramPtr->entryPoint))() \
  799. )
  800.  
  801. #define AbortScript(paramPtr) \
  802. (    paramPtr->request = xreqAbortScript, \
  803.     (*(MyProcPtr) (paramPtr->entryPoint))() \
  804. )
  805.  
  806. #define GoScript(paramPtr) \
  807. (    paramPtr->request = xreqGoScript, \
  808.     (*(MyProcPtr) (paramPtr->entryPoint))() \
  809. )
  810.  
  811. #define StepScript(paramPtr, stepInto) \
  812. (    paramPtr->inArgs[0] = (long)stepInto, \
  813.     paramPtr->request = xreqStepScript, \
  814.     (*(MyProcPtr) (paramPtr->entryPoint))() \
  815. )
  816.  
  817. #define CountHandlers(paramPtr, handlerCount) \
  818. (    paramPtr->inArgs[0] = (long)handlerCount, \
  819.     paramPtr->request = xreqCountHandlers, \
  820.     (*(MyProcPtr) (paramPtr->entryPoint))() \
  821. )
  822.  
  823. #define GetHandlerInfo(paramPtr, handlerNum, handlerName, objectName, varCount) \
  824. (    paramPtr->inArgs[0] = (long)handlerNum, \
  825.     paramPtr->inArgs[1] = (long)handlerName, \
  826.     paramPtr->inArgs[2] = (long)objectName, \
  827.     paramPtr->inArgs[3] = (long)varCount, \
  828.     paramPtr->request = xreqGetHandlerInfo, \
  829.     (*(MyProcPtr) (paramPtr->entryPoint))() \
  830. )
  831.  
  832. #define GetVarInfo(paramPtr, handlerNum, varNum, varName, isGlobal, varValue, varHndl) \
  833. (    paramPtr->inArgs[0] = (long)handlerNum, \
  834.     paramPtr->inArgs[1] = (long)varNum, \
  835.     paramPtr->inArgs[2] = (long)varName, \
  836.     paramPtr->inArgs[3] = (long)isGlobal, \
  837.     paramPtr->inArgs[4] = (long)varValue, \
  838.     paramPtr->inArgs[5] = (long)varHndl, \
  839.     paramPtr->request = xreqGetVarInfo, \
  840.     (*(MyProcPtr) (paramPtr->entryPoint))() \
  841. )
  842.  
  843. #define SetVarValue(paramPtr, handlerNum, varNum, varHndl) \
  844. (    paramPtr->inArgs[0] = (long)handlerNum, \
  845.     paramPtr->inArgs[1] = (long)varNum, \
  846.     paramPtr->inArgs[2] = (long)varHndl, \
  847.     paramPtr->request = xreqSetVarValue, \
  848.     (*(MyProcPtr) (paramPtr->entryPoint))() \
  849. )
  850.  
  851. #define GetStackCrawl(paramPtr) \
  852. (    paramPtr->request = xreqGetStackCrawl, \
  853.     (*(MyProcPtr) (paramPtr->entryPoint))(), \
  854.     (Handle)paramPtr->outArgs[0] \
  855. )
  856.  
  857. #define TraceScript(paramPtr, traceInto) \
  858. (    paramPtr->inArgs[0] = (long)traceInto, \
  859.     paramPtr->request = xreqTraceScript, \
  860.     (*(MyProcPtr) (paramPtr->entryPoint))() \
  861. )
  862.  
  863. #endif _HyperXCmd_LSC_
  864.